package com.one.consumer.user.presenter;

import android.content.Context;

import com.one.common.model.http.callback.ObserverOnResultListener;
import com.one.common.presenter.BaseApiPresenter;
import com.one.common.view.base.BaseActivity;
import com.one.common.view.base.IListView;
import com.one.consumer.user.model.UserModel;
import com.one.consumer.user.model.item.AddressItem;

import java.util.ArrayList;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/28 5:23 PM
 * description ：
 **/
public class AddressListPresenter extends BaseApiPresenter<IListView, UserModel> {
    public AddressListPresenter(IListView mView, Context mContext) {
        super(mView, mContext, new UserModel((BaseActivity) mContext));
    }


    /**
     * 获取地址列表
     */
    public void getAddressList(){
        mModel.getAddressList(mView.getPage() + "", new ObserverOnResultListener<ArrayList<AddressItem>>() {
            @Override
            public void onResult(ArrayList<AddressItem> addressItems) {
                if(mView!=null){
                    mView.loadSuccess(addressItems);
                }
            }
        });
    }
}
